#include <core/synced_current_pose.h>
#include <boost/thread/locks.hpp>

using boost::unique_lock;

void SyncedCurrentPose::set_current_pose(const player_pose2d &current_pose) {
  unique_lock<mutex> lock(mutex_);
  current_pose_ = current_pose;
}

player_pose2d SyncedCurrentPose::current_pose() {
  unique_lock<mutex> lock(mutex_);
  return current_pose_;
}

player_point_2d SyncedCurrentPose::current_position() {
  unique_lock<mutex> lock(mutex_);
  player_point_2d current_position;
  current_position.px = current_pose_.px;
  current_position.py = current_pose_.py;
  return current_position;
}
